package com.rattsoftware.server.service;

import java.util.List;

import com.rattsoftware.server.admin.model.Course;
import com.rattsoftware.server.admin.model.exceptions.RattsSecurityException;
import com.rattsoftware.server.admin.model.paging.PagingLoadConfig;
import com.rattsoftware.server.admin.model.paging.PagingLoadResult;

public interface CourseService {

	/**
	 * Returns a given Course given the ID.
	 * 
	 * @param courseId
	 *            Id of the Course to retrieve.
	 * @return Course
	 */
	Course getCourse(int courseId) throws RattsSecurityException;
	
	/**
	 * Deletes the course data.
	 * 
	 * @param course
	 */									
	void deleteCourse(Course course) throws RattsSecurityException;

	/**
	 * Deletes all the submitted data specified by the IDs 
	 * 
	 * @param courseIds
	 * @throws RattsSecurityException
	 */
	void deleteCourse(List<Integer> courseIds) throws RattsSecurityException;
	
	/**
	 * Calculates the number of course units under a given course.
	 * 
	 * @param courseId
	 * @return Integer (positive number, 0 for no courseUnits)
	 */
	Integer getCourseUnitCount(int courseId) throws RattsSecurityException;
	
	/**
	 * Retrieves a page of the course data.
	 * 
	 * @param user
	 *            User
	 * @param pagingLoadConfig
	 *            config to specify paging related config
	 * @return PagingLoadResult containing a page of course data
	 */
	PagingLoadResult<Course> getCourseList( PagingLoadConfig pagingLoadConfig) throws RattsSecurityException;

	/**
	 * Saves a new and modified course to the database.
	 * 
	 * @param course the course to save.
	 * @return course saved with id populated
	 * @throws RattsSecurityException For any <tt>security related</tt> that occurs on the <tt>service layer.</tt>
	 */
	Course saveCourse(Course course) throws RattsSecurityException;
	
	/**
	 * Persists a given list of Courses to the database.
	 * 
	 * @param courses List of Courses to persist.
	 */
	void saveCourses(List<Course> courses) throws RattsSecurityException;
	
}
